/*
 * File: ftk_list_render.h    
 * Author:  Li XianJing <xianjimli@hotmail.com>
 * Brief:   list render
 *
 * Copyright (c) 2009 - 2010  Li XianJing <xianjimli@hotmail.com>
 *
 * Licensed under the Academic Free License version 2.1
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/*
 * History:
 * ================================================================
 * 2009-11-15 Li XianJing <xianjimli@hotmail.com> created
 *
 */

#ifndef FTK_LIST_RENDER_H
#define FTK_LIST_RENDER_H

#include "ftk_canvas.h"
#include "ftk_list_model.h"

FTK_BEGIN_DECLS

struct _FtkListRender;
typedef struct _FtkListRender FtkListRender;

typedef Ret  (*FtkListRenderInit)(FtkListRender* thiz, FtkListModel* model, FtkWidget* list_view);
typedef Ret  (*FtkListRenderPaint)(FtkListRender* thiz, FtkCanvas* canvas, int pos, int x, int y, int w, int h);
typedef void (*FtkListRenderDestroy)(FtkListRender* thiz);

struct _FtkListRender
{
	FtkListRenderInit    init;
	FtkListRenderPaint   paint;
	FtkListRenderDestroy destroy;

	char priv[ZERO_LEN_ARRAY];
};

static inline Ret ftk_list_render_init(FtkListRender* thiz, FtkListModel* model, FtkWidget* list_view)
{
	return_val_if_fail(thiz != NULL && thiz->init != NULL, RET_FAIL);

	return thiz->init(thiz, model, list_view);
}

static inline Ret ftk_list_render_paint(FtkListRender* thiz, FtkCanvas* canvas, int pos, int x, int y, int w, int h)
{
	return_val_if_fail(thiz != NULL && thiz->paint != NULL, RET_FAIL);

	return thiz->paint(thiz, canvas, pos, x, y, w, h);
}

static inline void ftk_list_render_destroy(FtkListRender* thiz)
{
	if(thiz != NULL && thiz->destroy != NULL)
	{
		thiz->destroy(thiz);
	}

	return;
}

FTK_END_DECLS

#endif/*FTK_LIST_RENDER_H*/

